
/**
*********************************************************************************************************
* @file      lfs_port.h
* @brief     
* @details   
* @author    tang zheng
* @date      2022-08-27
* @version   v0.1
* *********************************************************************************************************
*/

#include "lfs.h"


#define LFS_EXT_FLASH   1

#ifdef LFS_EXT_FLASH
#include "IC_W25Qxx.h"

#define LFS_FLASH_START_ADRRESS     0xFC0000 //#define LFS_FLASH_START_ADRRESS     0xF80000 
#define LFS_FLASH_SIZE              0x20000
#define HAL_FLASH_BLOCK_4K          0x1000

#define LFS_RAM_SIZE                256

#else

#define FR5090_BUS_START_ADDRESS    0x08000000
#define LFS_FLASH_START_ADRRESS     FR5090_BUS_START_ADDRESS + 0x40000 
#define LFS_FLASH_SIZE              0x20000
#define HAL_FLASH_BLOCK_4K          0x1000

#endif


extern lfs_t lfs;

void    lfs_custom_init(void);
int32_t lfs_free_size(void);
void lfs_custom_test(void);

void lfs_custom_test_write_file(void);
void lfs_custom_test_read_file(void);

void lfs_custom_read_sys_param(void);
void lfs_custom_write_sys_param(void);

void extern_flash_read(uint8_t *Buffer, uint32_t flash_Address, uint32_t Length);
void extern_flash_write(uint8_t *Buffer, uint32_t flash_Address, uint32_t Length);
void extern_flash_erase(uint32_t flash_Address);
void extern_flash_erase_ex(uint32_t flash_Address,uint32_t len);





